package com.bea.ftd.common.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.bea.ftd.common.enums.DateFormatEnum;
import com.bea.ftd.common.intf.IGatewayEntity;
import com.bea.ftd.common.utils.DateUtil;

import lombok.Data;

@Data
@Entity
@Table(name = "msg_mapping")
public class MsgMapping  implements IGatewayEntity {

	private static final long serialVersionUID = 3700807518163560737L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Long id;

	@Column(name = "interface_id")
	private String interfaceId;

	@Column(name = "in_msg_id")
	private Long inMsgId;

	@Column(name = "in_msg_param_name")
	private String inMsgParamName;

	@Column(name = "out_msg_id")
	private Long outMsgId;

	@Column(name = "out_msg_param_name")
	private String outMsgParamName;

	@Column(name = "is_activated")
	private Long isActivated;

	@Column(name = "create_time")
	private java.util.Date createTime;

	@Column(name = "update_time")
	private java.util.Date updateTime;
	
	public String getFormatCreateTime() {
		if (null == createTime) {
			return "";
		}
		return DateUtil.formatDate(createTime, DateFormatEnum.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
	}

	public String getFormatUpdateTime() {
		if (null == updateTime) {
			return "";
		}
		return DateUtil.formatDate(updateTime, DateFormatEnum.YEAR_MONTH_DAY_HOUR_MINUTE_SECOND);
	}

}
